﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class Manage_AttoneyList : System.Web.UI.Page, HZ.MBSM.BLL.IPageDescribe
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (HZ.MBSM.BLL.Login.CheckAssert(this.UseAccountType))
        {

            showGridView();
        }
    }
    protected void Button5_Click(object sender, EventArgs e)
    {

    }

    /// <summary>
    /// 数据绑定
    /// </summary>
    public void showGridView()
    {
        string strConditions;
        strConditions = fctConditions();
        Db db = new Db();
        DbPage dbPage = new DbPage(db);
        dbPage.Table = "Attorney";
        dbPage.Key = "accountid";
        dbPage.Where = strConditions;                        //
        dbPage.SelectField = "accountid,attorneyname,UserCode";                             //可以不设，默认为“*”

        dbPage.PageIndex = SysFun.ToInt(Request["CurrentlyPageIndex"]);          //要显示第几页   
        dbPage.PageSize = 10;//Request.QueryString["PS"]);
        dbPage.OrderBy = "attorneyname,UserCode";
        System.Data.IDataReader dr = dbPage.ExecuteReader();
        DlAttorney.DataSource = dr;
        DlAttorney.DataBind();
        dr.Close();
        dr.Dispose();
        db.Close();
        dbPage.Db.Close();
        db.Close();
        this.DbPageFlip1.DbPage = dbPage;//将数据传给控键


    }
    /// <summary>
    /// 生成查询条件
    /// </summary>
    /// <returns></returns>
    public string fctConditions()
    {
        string strtemp = "", AttorneyName = "", _UserCode;
        AttorneyName = txtAttorneyName.Text.ToString().Trim();
        _UserCode = txtUserCode.Text.ToString().Trim();
        if (_UserCode != "")
        {
            strtemp = strtemp + " UserCode like '%" + _UserCode + "%' and";
        }
        if (AttorneyName != "")
        {
            strtemp = strtemp + " AttorneyName like '%" + AttorneyName + "%' and";
        }
        if (strtemp != "")
        {
            strtemp = "  " + strtemp.Substring(0, strtemp.Length - 3);
        }

        return strtemp;

    }

    #region IPageDescribe 成员

    public string Name
    {
        get { return "招标中心管理"; }
    }

    public string Describe
    {
        get { return ""; }
    }

    public string ParentName
    {
        get { return "用户管理"; }
    }

    public System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> UseAccountType
    {
        get
        {
            System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
            _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAdmin);
            return _AccountType;
        }
    }

    #endregion
}
